define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'dahuinew/dljzywonekp/index',
                    add_url: 'dahuinew/dljzywonekp/add',
                    edit_url: 'dahuinew/dljzywonekp/edit',
                    del_url: 'dahuinew/dljzywonekp/del',
                    multi_url: 'dahuinew/dljzywonekp/multi',
                    table: 'dahuinew_dljzywonekp',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        //{checkbox: true},
                        {field: 'id', title: __('Id'), operate:false},
                        //{field: 'dljzyw_id', title: __('Dljzyw_id')},
                        {field: 'kpssyf', title: __('Kpssyf'), operate:false},
                        {field: 'gthmz', title: __('Gthmz'), operate:false},
                        {field: 'kpje', title: __('Kpje'), operate:false},
                        {field: 'yqsqfwf', title: __('Yqsqfwf'), operate:false},
                        {field: 'yqsqsj', title: __('Yqsqsj'), operate:false},
                        {field: 'zhsl', title: __('Zhsl'), operate:false},
                        {field: 'sskh', title: __('Sskh'), operate:false},
                        {field: 'remark', title: __('Remark'), operate:false},
                        //{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        //{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        //{field: 'dljzywone.id', title: __('Dljzywone.id')},
                        //{field: 'dljzywone.pid', title: __('Dljzywone.pid')},
                        //{field: 'dljzywone.issh', title: __('Dljzywone.issh')},
                        //{field: 'dljzywone.htbh', title: __('Dljzywone.htbh')},
                        //{field: 'dljzywone.htstart', title: __('Dljzywone.htstart')},
                        //{field: 'dljzywone.htend', title: __('Dljzywone.htend')},
                        //{field: 'dljzywone.htend2', title: __('Dljzywone.htend2')},
                        //{field: 'dljzywone.htje', title: __('Dljzywone.htje'), operate:'BETWEEN'},
                        //{field: 'dljzywone.zhsl', title: __('Dljzywone.zhsl')},
                        //{field: 'dljzywone.zcyq', title: __('Dljzywone.zcyq')},
                        //{field: 'dljzywone.gsname', title: __('Dljzywone.gsname')},
                        //{field: 'dljzywone.gssh', title: __('Dljzywone.gssh')},
                        //{field: 'dljzywone.khh', title: __('Dljzywone.khh')},
                        //{field: 'dljzywone.zhanghao', title: __('Dljzywone.zhanghao')},
                        //{field: 'dljzywone.shuiz', title: __('Dljzywone.shuiz')},
                        //{field: 'dljzywone.faren', title: __('Dljzywone.faren')},
                        //{field: 'dljzywone.farentel', title: __('Dljzywone.farentel')},
                        //{field: 'dljzywone.farenidc', title: __('Dljzywone.farenidc')},
                        //{field: 'dljzywone.contact', title: __('Dljzywone.contact')},
                        //{field: 'dljzywone.contacttel', title: __('Dljzywone.contacttel')},
                        //{field: 'dljzywone.gssbpsw', title: __('Dljzywone.gssbpsw')},
                        //{field: 'dljzywone.frswpsw', title: __('Dljzywone.frswpsw')},
                        //{field: 'dljzywone.kpyw', title: __('Dljzywone.kpyw')},
                        //{field: 'dljzywone.kpinfo', title: __('Dljzywone.kpinfo')},
                        //{field: 'dljzywone.jbry', title: __('Dljzywone.jbry')},
                        //{field: 'dljzywone.create_time', title: __('Dljzywone.create_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        //{field: 'dljzywone.update_time', title: __('Dljzywone.update_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        //{field: 'dljzywone.admin_id', title: __('Dljzywone.admin_id')},
                        //{field: 'dljzywone.isxy', title: __('Dljzywone.isxy')},
                        //{field: 'dljzywone.zczt', title: __('Dljzywone.zczt')},
                        //{field: 'dljzywone.xftype', title: __('Dljzywone.xftype')},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});